﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using JESAI.Demo.Models;
using JESAI.HtmlTemplate.Pdf.Controllers;
using JESAI.HtmlTemplate.Pdf.MemoryCache;

namespace JESAI.Demo.Controllers
{
    public class HomeController : BaseComtroller
    {
        private readonly ILogger<HomeController> _logger;
        private readonly ICacheService _cache;

        public HomeController(ILogger<HomeController> logger, ICacheService cache)
        {
            _logger = logger;
            _cache = cache;
        }

        public IActionResult GetPDF()
        {
            var m = new Student()
            {
                Name = "111111",
                Address = "3333333",
                Age = 22,
                Sex = "男",
                Tel = "19927352816",
                Des = "2222222222222222222"
            };
            return View(m);
            //return PDFResult<Student>(m);
        }

        public IActionResult Index()
        {
            return View();
        }

        public IActionResult Privacy()
        {
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }
}
